//
//  BaseTableViewController.swift
//  ZTWeiboo
//
//  Created by mac on 15/8/6.
//  Copyright © 2015年 YYL. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,UserLoginViewDelegate {

    let userLogin = false
    
    var visitorView : UserLoginView?
    
    override func viewDidLoad() {
        
        userLogin ? super.loadView() : setupVisitorView()
        
    }
    private func setupVisitorView(){
        visitorView = UserLoginView()
        visitorView?.delegate = self
        view = visitorView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "userLoginViewWillRegister")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "userLoginViewWillLogin")
        
    }
    
    func userLoginViewWillRegister() {
        print("注册")
    }

    func userLoginViewWillLogin() {
        let nav = UINavigationController(rootViewController: OAuthViewController())
        
        presentViewController(nav, animated: true, completion: nil)
        
    }
    
}